
const axios = require('axios');
const config = {

    // 自定义请求头
    headers: {
        'Authorization': 'APPCODE 87c5a368d48b45a093d44157d81d880a',
        'Content-Type':'multipart/form-data; boundary=----WebKitFormBoundarymNhhHqUh0p0gfFa8'
    },
}
// const config2 = {
//
//     // 自定义请求头
//     headers: {
//         'Authorization': 'APPCODE 87c5a368d48b45a093d44157d81d880a',
//         'Content-Type':'multipart/form-data; boundary=----WebKitFormBoundarymNhhHqUh0p0gfFa8'
//     },
// }

// 获取空气情况
function getGas() {
    let a = new FormData();
    a.append('cityId','1189')
    return axios.post('http://aliv18.data.moji.com/whapi/json/alicityweather/aqi',a,config)
        .then(res=>{
            return res.data
        }).catch(err=>{
            console.log(err)
        })

}
// 获取天气情况
function getWeather() {
    let a = new FormData();
    a.append('cityId','1189')
    return axios.post('http://aliv18.data.moji.com/whapi/json/alicityweather/condition',a,config)
        .then(res=>{
            return res.data
        }).catch(err=>{
            console.log(err)
        })

}

export {getGas,getWeather}